/**
 * @description arcgis任务
*/

const Task = require('./task.js')
const config = global.config
const tile = config.tile || {}

class ArcGis extends Task {
  /**
  * @function 获取下载地址
  * @param {Object} item 瓦片对象
  */
  getUrl (item) {
    let x = item.x, y = item.y, z = item.z
    let params = this.layer.mapProvider.params
    let url = this.layer.layerProvider.url
    let s = params.subdomains[Math.floor(Math.random() * params.subdomains.length)] // 服务主机
    url = url.replace('{s}', s).replace('{x}', x).replace('{y}', y).replace('{z}', z)
    return url
  }
}

module.exports = ArcGis